package cn.edu.scnu.semart.order.service;

import cn.edu.scnu.semart.model.order.Order;
import cn.edu.scnu.semart.model.order.OrderDTO;
import cn.edu.scnu.semart.model.order.OrderStatistics;
import cn.edu.scnu.semart.vo.order.OrderQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

public interface OrderService {
    OrderDTO createOrder(Integer userId, Integer addressId);
    OrderDTO getOrderDetails(Integer orderId);
    List<OrderDTO> getUserOrders(Integer userId, String status);
    void updateOrderStatus(Integer orderId, String status);
    void autoConfirmReceipt();
    OrderStatistics getOrderStatistics(Date start, Date end, String granularity);
    void handlePaymentCallback(String orderNumber, boolean success);
    List<OrderDTO> getOrdersByProductName(String productName);
    //订单分页查询
    IPage<OrderDTO> selectPage(Page<Order> pageParam, OrderQueryVo orderQueryVo);

    Order getById(Integer orderId);

    void updateById(Order order);

/*    @Transactional
    String updateOrderNumberByOutTradeNo(String outTradeNo);*/
    Order getByPayTradeNo(String payTradeNo);
}